<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Http\Requests\FeedbackRequest;
use App\Models\Feedback;
use Illuminate\Http\Request;

class FeedbackController extends Controller
{
    //提交已经反馈
    public function store(FeedbackRequest $request)
    {
        $images = $request->get('images', '');
        Feedback::query()->create([
            'user_id' => auth('api')->user()->id ?? 0,
            'images' => $images ? json_encode(explode(',', $images)) : '',
            'content' => $request->get('content')
        ]);
        return successReturn('提交成功');
    }
}
